class OfferController < ApplicationController
  before_filter :user_authorize
  before_filter :sys_before_log
  #before_filter :privilege_filter

  #得到某一个申购单的所有出价信息
  def getOffersByPurchaseId
    if session[:auditor_id] !=nil || session[:applicant_id] != nil
      offers = Offer.find(:all,:conditions=>["purchase_id = ?",params[:id]],:order => 'amount ASC')
      jsonstr = "{totalProperty:"+offers.length.to_s+",root:"+offers.to_json(:include=>{:vendor=>{:except=>[:legal_person_photo,:business_license_photo,:aptitude_photo]}})+"}"
      logger.info jsonstr
    end
    render :text=>jsonstr, :layout=>false
  end
end
